#include <iostream>
#include "control.h"
#include<cstring>
#include<Windows.h>
using namespace std;

int main() 
{
	srand((unsigned int)time(NULL));
	initgraph(800, 800);
	setbkcolor(WHITE);
	cleardevice();
	Control* pControl = new Control;
	BeginBatchDraw();
	while (1) 
	{
		cleardevice();
		pControl->draw();
		pControl->move();
	
		pControl->eat();

		FlushBatchDraw();
		if (pControl->gameover()== 0)
		{
			Sleep(500);
			system("CLS");
			cout << "\a" << "Game Over!" << endl;
			break;
		}
		
	}
	EndBatchDraw();
	closegraph();
	return 0;
}